package com.pomelo.base.core.entity;

import java.util.HashMap;
import java.util.Map;

import com.pomelo.base.core.dao.DatabaseEntity;

/**
 * 数据源
 *
 * @author biankudingcha
 * @date: 2021-08-15
 * @since 1.0.0
 */
public class POMELO_SYS_DATASOURCE implements DatabaseEntity, java.io.Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 修改的数据
     */
    private Map<String, Object> changeData = new HashMap<String, Object>();

    /**
     * 主键
     */
    private java.lang.String wid;

    /**
     * 数据源ID
     */
    private java.lang.String datasourceId;

    /**
     * 数据源名称
     */
    private java.lang.String datasourceName;

    /**
     * 驱动类
     */
    private java.lang.String datasourceDriverClassName;

    /**
     * URL
     */
    private java.lang.String datasourceUrl;

    /**
     * 用户名
     */
    private java.lang.String datasourceUsername;

    /**
     * 密码
     */
    private java.lang.String datasourcePassword;

    /**
     * 数据库类型
     */
    private java.lang.String datasourceDbtype;

    /**
     * 是否启用
     */
    private java.lang.String enabled;

    /**
     * hibernate数据库方言
     */
    private java.lang.String hibernateDialect;

    /**
     * 数据库SCHEMA
     */
    private java.lang.String hibernateDefaultSchema;

    /**
     * hibernate创建表方式
     */
    private java.lang.String hibernateHbm2ddlAuto;

    /**
     * 环境(dev,test,prod)
     */
    private java.lang.String environment;

    public POMELO_SYS_DATASOURCE() {

    }

    public POMELO_SYS_DATASOURCE(Map<String, Object> data) {
        if (data.containsKey("WID")) {
            this.wid = (java.lang.String) data.get("WID");
        }
        if (data.containsKey("DATASOURCE_ID_")) {
            this.datasourceId = (java.lang.String) data.get("DATASOURCE_ID_");
        }
        if (data.containsKey("DATASOURCE_NAME_")) {
            this.datasourceName = (java.lang.String) data.get("DATASOURCE_NAME_");
        }
        if (data.containsKey("DATASOURCE_DRIVER_CLASS_NAME_")) {
            this.datasourceDriverClassName = (java.lang.String) data.get("DATASOURCE_DRIVER_CLASS_NAME_");
        }
        if (data.containsKey("DATASOURCE_URL_")) {
            this.datasourceUrl = (java.lang.String) data.get("DATASOURCE_URL_");
        }
        if (data.containsKey("DATASOURCE_USERNAME_")) {
            this.datasourceUsername = (java.lang.String) data.get("DATASOURCE_USERNAME_");
        }
        if (data.containsKey("DATASOURCE_PASSWORD_")) {
            this.datasourcePassword = (java.lang.String) data.get("DATASOURCE_PASSWORD_");
        }
        if (data.containsKey("DATASOURCE_DBTYPE_")) {
            this.datasourceDbtype = (java.lang.String) data.get("DATASOURCE_DBTYPE_");
        }
        if (data.containsKey("ENABLED_")) {
            this.enabled = (java.lang.String) data.get("ENABLED_");
        }
        if (data.containsKey("HIBERNATE_DIALECT_")) {
            this.hibernateDialect = (java.lang.String) data.get("HIBERNATE_DIALECT_");
        }
        if (data.containsKey("HIBERNATE_DEFAULT_SCHEMA_")) {
            this.hibernateDefaultSchema = (java.lang.String) data.get("HIBERNATE_DEFAULT_SCHEMA_");
        }
        if (data.containsKey("HIBERNATE_HBM2DDL_AUTO_")) {
            this.hibernateHbm2ddlAuto = (java.lang.String) data.get("HIBERNATE_HBM2DDL_AUTO_");
        }
        if (data.containsKey("ENVIRONMENT_")) {
            this.environment = (java.lang.String) data.get("ENVIRONMENT_");
        }
        if (data != null) {
            this.changeData.putAll(data);
        }
    }

    /**
     * 获取主键
     *
     * @return java.lang.String
     */
    public java.lang.String getWid() {
        return wid;
    }

    /**
     * 设置主键
     *
     * @param wid 主键
     */
    public void setWid(java.lang.String wid) {
        this.wid = wid;
        changeData.put("WID", wid);
    }

    /**
     * 获取数据源ID
     *
     * @return java.lang.String
     */
    public java.lang.String getDatasourceId() {
        return datasourceId;
    }

    /**
     * 设置数据源ID
     *
     * @param datasourceId 数据源ID
     */
    public void setDatasourceId(java.lang.String datasourceId) {
        this.datasourceId = datasourceId;
        changeData.put("DATASOURCE_ID_", datasourceId);
    }

    /**
     * 获取数据源名称
     *
     * @return java.lang.String
     */
    public java.lang.String getDatasourceName() {
        return datasourceName;
    }

    /**
     * 设置数据源名称
     *
     * @param datasourceName 数据源名称
     */
    public void setDatasourceName(java.lang.String datasourceName) {
        this.datasourceName = datasourceName;
        changeData.put("DATASOURCE_NAME_", datasourceName);
    }

    /**
     * 获取驱动类
     *
     * @return java.lang.String
     */
    public java.lang.String getDatasourceDriverClassName() {
        return datasourceDriverClassName;
    }

    /**
     * 设置驱动类
     *
     * @param datasourceDriverClassName 驱动类
     */
    public void setDatasourceDriverClassName(java.lang.String datasourceDriverClassName) {
        this.datasourceDriverClassName = datasourceDriverClassName;
        changeData.put("DATASOURCE_DRIVER_CLASS_NAME_", datasourceDriverClassName);
    }

    /**
     * 获取URL
     *
     * @return java.lang.String
     */
    public java.lang.String getDatasourceUrl() {
        return datasourceUrl;
    }

    /**
     * 设置URL
     *
     * @param datasourceUrl URL
     */
    public void setDatasourceUrl(java.lang.String datasourceUrl) {
        this.datasourceUrl = datasourceUrl;
        changeData.put("DATASOURCE_URL_", datasourceUrl);
    }

    /**
     * 获取用户名
     *
     * @return java.lang.String
     */
    public java.lang.String getDatasourceUsername() {
        return datasourceUsername;
    }

    /**
     * 设置用户名
     *
     * @param datasourceUsername 用户名
     */
    public void setDatasourceUsername(java.lang.String datasourceUsername) {
        this.datasourceUsername = datasourceUsername;
        changeData.put("DATASOURCE_USERNAME_", datasourceUsername);
    }

    /**
     * 获取密码
     *
     * @return java.lang.String
     */
    public java.lang.String getDatasourcePassword() {
        return datasourcePassword;
    }

    /**
     * 设置密码
     *
     * @param datasourcePassword 密码
     */
    public void setDatasourcePassword(java.lang.String datasourcePassword) {
        this.datasourcePassword = datasourcePassword;
        changeData.put("DATASOURCE_PASSWORD_", datasourcePassword);
    }

    /**
     * 获取数据库类型
     *
     * @return java.lang.String
     */
    public java.lang.String getDatasourceDbtype() {
        return datasourceDbtype;
    }

    /**
     * 设置数据库类型
     *
     * @param datasourceDbtype 数据库类型
     */
    public void setDatasourceDbtype(java.lang.String datasourceDbtype) {
        this.datasourceDbtype = datasourceDbtype;
        changeData.put("DATASOURCE_DBTYPE_", datasourceDbtype);
    }

    /**
     * 获取是否启用
     *
     * @return java.lang.String
     */
    public java.lang.String getEnabled() {
        return enabled;
    }

    /**
     * 设置是否启用
     *
     * @param enabled 是否启用
     */
    public void setEnabled(java.lang.String enabled) {
        this.enabled = enabled;
        changeData.put("ENABLED_", enabled);
    }

    /**
     * 获取hibernate数据库方言
     *
     * @return java.lang.String
     */
    public java.lang.String getHibernateDialect() {
        return hibernateDialect;
    }

    /**
     * 设置hibernate数据库方言
     *
     * @param hibernateDialect hibernate数据库方言
     */
    public void setHibernateDialect(java.lang.String hibernateDialect) {
        this.hibernateDialect = hibernateDialect;
        changeData.put("HIBERNATE_DIALECT_", hibernateDialect);
    }

    /**
     * 获取数据库SCHEMA
     *
     * @return java.lang.String
     */
    public java.lang.String getHibernateDefaultSchema() {
        return hibernateDefaultSchema;
    }

    /**
     * 设置数据库SCHEMA
     *
     * @param hibernateDefaultSchema 数据库SCHEMA
     */
    public void setHibernateDefaultSchema(java.lang.String hibernateDefaultSchema) {
        this.hibernateDefaultSchema = hibernateDefaultSchema;
        changeData.put("HIBERNATE_DEFAULT_SCHEMA_", hibernateDefaultSchema);
    }

    /**
     * 获取hibernate创建表方式
     *
     * @return java.lang.String
     */
    public java.lang.String getHibernateHbm2ddlAuto() {
        return hibernateHbm2ddlAuto;
    }

    /**
     * 设置hibernate创建表方式
     *
     * @param hibernateHbm2ddlAuto hibernate创建表方式
     */
    public void setHibernateHbm2ddlAuto(java.lang.String hibernateHbm2ddlAuto) {
        this.hibernateHbm2ddlAuto = hibernateHbm2ddlAuto;
        changeData.put("HIBERNATE_HBM2DDL_AUTO_", hibernateHbm2ddlAuto);
    }

    /**
     * 获取环境(dev,test,prod)
     *
     * @return java.lang.String
     */
    public java.lang.String getEnvironment() {
        return environment;
    }

    /**
     * 设置环境(dev,test,prod)
     *
     * @param environment 环境(dev,test,prod)
     */
    public void setEnvironment(java.lang.String environment) {
        this.environment = environment;
        changeData.put("ENVIRONMENT_", environment);
    }

    /**
     * 转为Map
     *
     * @return Map
     */
    @Override
    public Map<String, Object> toMap() {
        Map<String, Object> data = new HashMap<String, Object>();
        data.put("WID", this.wid);
        data.put("DATASOURCE_ID_", this.datasourceId);
        data.put("DATASOURCE_NAME_", this.datasourceName);
        data.put("DATASOURCE_DRIVER_CLASS_NAME_", this.datasourceDriverClassName);
        data.put("DATASOURCE_URL_", this.datasourceUrl);
        data.put("DATASOURCE_USERNAME_", this.datasourceUsername);
        data.put("DATASOURCE_PASSWORD_", this.datasourcePassword);
        data.put("DATASOURCE_DBTYPE_", this.datasourceDbtype);
        data.put("ENABLED_", this.enabled);
        data.put("HIBERNATE_DIALECT_", this.hibernateDialect);
        data.put("HIBERNATE_DEFAULT_SCHEMA_", this.hibernateDefaultSchema);
        data.put("HIBERNATE_HBM2DDL_AUTO_", this.hibernateHbm2ddlAuto);
        data.put("ENVIRONMENT_", this.environment);
        return data;
    }

    /**
     * 返回修改的数据Map
     *
     * @return Map
     */
    @Override
    public Map<String, Object> toChangeDataMap() {
        return changeData;
    }
}